/*
 * @Author: sean_kei@163.com
 * @Date: 2021-06-08 15:07:38
 * @LastEditors: sean_kei@163.com
 * @LastEditTime: 2022-08-10 11:23:57
 */
package com.wxhandle.cleandemo.core.domain.identity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.wxhandle.cleandemo.core.domain.base.Auditable;

import org.springframework.context.annotation.Lazy;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Entity
@Table(name = "SysService")
public class SysService implements Serializable {

    public enum ClaimType {
        PERMISSION("后端"),
        MENU("前端");

        String desc;

        ClaimType(String desc){
            this.desc = desc;
        }
    };
    /**
     * 声明标识，字符串，唯一
     */
    @Id
    @Column(name = "id", length = 50, nullable = false)
    private String id;

    @Column(name = "description", length = 100, nullable = false)
    private String description;
    /**
     * 声明类型
     */
    @Column(name = "type", nullable = false)
    private ClaimType type;

    //引用的权限实体对象集合
    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    @JoinColumn(name="service_id", referencedColumnName = "id",insertable=false, updatable=false)
    private List<SysClaim> claims;


}
